﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Shared/ContentMaster.master"
    CodeFile="linkList.aspx.cs" Inherits="ltMan_links_linkList" %>

<asp:Content ID="C1" ContentPlaceHolderID="head" runat="Server">
<script>
    function PopUpShowing(sender, eventArgs) {
        var popUp = eventArgs.get_popUp();
        var gridWidth = sender.get_element().offsetWidth;
        var popUpWidth = parseInt(popUp.style.width);
        popUp.style.left = ((gridWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
    } 
</script>
</asp:Content>
<asp:Content ID="C2" ContentPlaceHolderID="CPH1" runat="Server">
    <telerik:RadAjaxManagerProxy runat="server" ID="proxy1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="b1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <div class="searchArea">
        名称：<telerik:RadTextBox EmptyMessage="搜索名称" ID="sName" runat="server" MaxLength="50" />
        <telerik:RadButton Icon-PrimaryIconCssClass="icon-search" runat="server" ID="b1"
            OnClick="b1_Click" Text="搜索" />
    </div>
    <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" OnDeleteCommand="RadGrid1_DeleteCommand"
        OnItemCommand="RadGrid1_ItemCommand" PageSize="12" OnItemCreated="RadGrid1_ItemCreated"
        OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand" OnItemDataBound="RadGrid1_ItemDataBound">
        <ClientSettings><ClientEvents OnPopUpShowing="PopUpShowing" />
            <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="340" />
        </ClientSettings>
        <MasterTableView CommandItemDisplay="Top" EditMode="PopUp" DataKeyNames="id">
            <CommandItemTemplate>
                <telerikEx:GridCommandEx ID="GridCommandEx1" runat="server" />
            </CommandItemTemplate>
            <PagerTemplate>
                <telerikEx:RadPagerEx ID="RadPagerEx1" runat="server" />
            </PagerTemplate>
            <Columns>
                <telerik:GridClientSelectColumn HeaderStyle-Width="28" ItemStyle-Width="28" />
                <telerik:GridBoundColumn DataField="id" Visible="false" />
                <telerik:GridBoundColumn HeaderStyle-Width="120" HeaderText="链接类别" DataField="jname"
                    DataFormatString="<nobr>{0}</nobr>" />
                <telerik:GridBoundColumn HeaderText="网站名称" DataField="name" DataFormatString="<nobr>{0}</nobr>" />
                <telerik:GridBoundColumn HeaderStyle-Width="120" HeaderText="链接地址" DataField="link"
                    DataFormatString="<nobr>{0}</nobr>" />
                <telerik:GridBoundColumn HeaderStyle-Width="120" HeaderText="图片地址" DataField="pic"
                    DataFormatString="<nobr>{0}</nobr>" />
                <telerik:GridBoundColumn HeaderStyle-Width="50" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center" HeaderText="序号" DataField="px" />
                <telerik:GridTemplateColumn HeaderStyle-Width="50" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center" HeaderText="移动">
                    <ItemTemplate>
                        <telerikEx:MoveCommandEx runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderStyle-Width="50" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center" HeaderText="操作">
                    <ItemTemplate>
                        <telerikEx:GridInlineCommandEx ID="GridInlineCommandEx1" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings EditFormType="Template" CaptionFormatString="当前修改[{0}]" CaptionDataField="name"
                InsertCaption="添加网站链接">
                <PopUpSettings Modal="true" Width="270" Height="270" />
                <FormTemplate>
                    <div class="ta-center">
                        <br />
                        <asp:HiddenField ID="HiddenField2" runat="server" Value='<%#Bind("id") %>' />
                        <telerik:RadTextBox MaxLength="50" Label="网站名称：" ID="RadTextBox1" runat="server"
                            Text='<%# Bind("name" ) %>' ToolTip="输入网站名称" EmptyMessage="输入网站名称" Width="180" /><asp:RequiredFieldValidator
                                runat="server" ID="r1" ControlToValidate="RadTextBox1" ErrorMessage="*" />
                    </div>
                    <div class="ta-center">
                        <br />
                        <telerik:RadTextBox MaxLength="100" Label="链接地址：" ID="RadTextBox2" runat="server"
                            Text='<%# Bind("link" ) %>' ToolTip="输入链接地址" EmptyMessage="输入链接地址" Width="180" />
                    </div>
                    <div class="ta-center">
                        <br />
                        <telerik:RadTextBox MaxLength="100" Label="图片地址：" ID="RadTextBox3" runat="server"
                            Text='<%# Bind("pic" ) %>' ToolTip="输入图片地址" EmptyMessage="输入图片地址" Width="180" />
                    </div>
                    <div class="ta-center">
                        <br />
                        链接类别：
                        <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Bind("jid")%>' />
                        <telerik:RadComboBox runat="server" ID="RadComboBox1" DataTextField="jname" DataValueField="jid"
                            Width="120" />
                    </div>
                    <div class="ta-center">
                        <br />
                        <telerik:RadButton ID="btnUpdate" Text="更新" runat="server" CommandName="Update" Visible='<%# !(Container.DataItem is Telerik.Web.UI.GridInsertionObject) %>'
                            Icon-PrimaryIconCssClass="icon-edit" />
                        <telerik:RadButton ID="btnInsert" Text="插入" runat="server" CommandName="PerformInsert"
                            Visible='<%# Container.DataItem is Telerik.Web.UI.GridInsertionObject %>' Icon-PrimaryIconCssClass="icon-add" />
                        <telerik:RadButton ID="btnCancel" Text="取消" runat="server" CausesValidation="False"
                            CommandName="Cancel" Icon-PrimaryIconCssClass="icon-cancel" />
                    </div>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
</asp:Content>
